package document.apps;

import antlr.RecognitionException;
import antlr.TokenStreamException;
import document.model.Book;
import metamodel.ClassNode;
import metamodel.TraversalUtils;
import metamodel.misc.GraphViz;
import metamodel.misc.JSONSerializer;

import java.io.IOException;
import java.io.ByteArrayOutputStream;

/**
 * User: fleipold
 * Date: 28-Nov-2007
 * Time: 22:48:10
 */
public class ExampleGraph {
    private final  ClassNode traversalModel;

    public ExampleGraph() throws TokenStreamException, RecognitionException, IOException {
        traversalModel = TraversalUtils.parse(getClass().getResourceAsStream("full.trv"));
        Book book = Book.buildExample();
        System.out.println(TraversalUtils.serialize(traversalModel, book));
        System.out.println(new JSONSerializer().serialize(traversalModel,book));



        GraphViz.graph(traversalModel, book,true, "Graph Test");
    }

    public static void main(String[] args) throws TokenStreamException, RecognitionException, IOException {
        new ExampleGraph();
    }

}
